package com.tinycloud.miracll.finance.api;

import com.tinycloud.common.core.web.controller.BaseController;
import com.tinycloud.common.log.annotation.Log;
import com.tinycloud.common.log.enums.BusinessType;
import com.tinycloud.miracll.finance.job.ProductCostTask;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.text.ParseException;

/**
 * 产品成本Controller
 * 
 * @author tiny
 * @date 2021-08-31
 */
@RestController
@RequestMapping("/api/productCost")
public class ProductCostAPI extends BaseController
{
    @Autowired
    private ProductCostTask productCostTask;


    /**
     * 生成产成品成本基础数据
     */

    @Log(title = "产品成本", businessType = BusinessType.INSERT)
    @GetMapping("/createProductCost")
    @ResponseBody
    public String createProductCost()  {
        String result = "success";
        try {
            productCostTask.createProductCost();
        } catch (ParseException e) {
            result = "error";
            e.printStackTrace();
        }
        return  result;
    }


}
